package com.example.bootintegration.exception;

import com.example.bootintegration.common.Result;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    /**
     * 所有的异常处理
     * //Exception 这个是所有异常的父类
     * @param e
     * @return
     */
//    @ExceptionHandler(Exception.class)
    public Object exceptionHandler(HttpServletRequest request, Exception e) {
        log.error("", e);
        return new Result<>(500, "error", e.getMessage());
    }

}